package com.heeexy.example.service;

import com.alibaba.fastjson.JSONObject;
import com.heeexy.example.dao.OperationLogDao;
import com.heeexy.example.entity.OperationLog;
import com.heeexy.example.util.CommonUtil;
import com.heeexy.example.util.constants.ErrorEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OperationLogService {
    @Autowired
    private OperationLogDao operationLogDao;

    /*
    * 通过账号Id查询操作日志
    **/
    public JSONObject findByStuUId(Integer uId){
        if (uId==null){
            return CommonUtil.successJson(ErrorEnum.E_10013);
        }
        return CommonUtil.successJson(operationLogDao.findByStuUId(uId));
    }

    /*
    * 新增日志
    * */
    public JSONObject insert(OperationLog operationLog){
        operationLogDao.insert(operationLog);
        return CommonUtil.successJson();
    }
}
